package control;

import java.sql.ResultSet;
import java.sql.SQLException;
import db.DBConnecter;

public class ModifyPasswordControl {
	private DBConnecter db;
	
	public ModifyPasswordControl() {
		db = new DBConnecter();
	}
	
	public String ModifyPassword(String currentAdminID, String password, String password_2) throws SQLException {
		String statement = "failure";

		System.out.println("modify admin password: " + password + " "+ password_2);

		if(password.equals(password_2)){
			String sql = "UPDATE admin set AdminPw = '"+password+"' where AdminID = '"+currentAdminID+"'";
			db.update(sql);
			statement = "success";
			
		}
		else {
			statement = "failure";
		}		
		return statement;

	}
}
